#!/bin/bash
# linux下安装thmar依赖库
# author guyadong
# date 2024/08/23

sh_folder=$(cd "$(dirname $0)"; pwd -P)


[ ! $(gcc -dumpmachine) ] \
    && echo "not install compiler gcc,install please" \
    && exit 255

if ! which cmake 2>/dev/null 
then
    echo cmake NOT FOUND. && exit 255 
fi
if ! which conan 2>/dev/null 
then 
    echo conan NOT FOUND. && exit 255
fi
if  ! python --version 2>/dev/null | grep "Python 3." 
then
    echo Python 3 required. && exit 255
fi

# 定义编译的版本类型(debug|release)
build_type=Release
[[ "${BUILD_TYPE,,}" =~ debug|release ]] && build_type=${BUILD_TYPE,,}
echo build_type=$build_type
machine=$(gcc -dumpmachine)
conan install $sh_folder -of $sh_folder/build/$machine -s build_type=${build_type^} \
    -o build_test=True -o with_paho=True \
    --build missing
	

# -pr:h esp32_gcc 指定目标平台的profile
# -pr:b default  指定编译平台的profile
# --build missing 编译缺少的依赖库

